#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "IOUnit.h"

#define NUMBER_OF_PRN_DEFAULT 100
#define OUTPUTPATH_DEFAULT "output.txt"
#define INT_SIZE 2
#define INT48_SIZE 6


class Control
{

public:
	static Control* getInstance()
	{
		if (singleControl == NULL)
			singleControl = new Control();

		return singleControl;
	}

	~Control()
	{
		delete this->ioUnit;
		if (buffer != NULL)
			delete buffer;

	};

	void start(int argc, char** argv);

protected:
	Control()
	{
		this->ioUnit = new IOUnit();
		buffer = NULL;
	};


private:
	static Control* singleControl;
	
	IOUnit* ioUnit;

	char* rand_cmd = "-rand";
	char* lrand_cmd = "-lrand48";
	char* buffer;

	bool rand_on = false;
	bool lrand48_on = false;
	int numberOfprn = 0;
	std::string* outputPath = NULL;
	
	void use_rand();
	void use_lrand48();

	int getNumberOfprn()
	{
		if (numberOfprn == 0)
			return NUMBER_OF_PRN_DEFAULT;
		else
			return numberOfprn;
	}

	char* getOutputPath()
	{
		if (outputPath == NULL)
			return OUTPUTPATH_DEFAULT;
		else
			return (char*)outputPath->c_str();
	}


};

